/****************************************************************************/
/* NAME:           Stepper.h                                          */
/* PURPOSE:        Manage all Stepper                                       */
/* CREATED_BY:     Vyx                                                      */
/* CREATION_DATE:  07/07/2012                                               */
/************************************** (C) Copyright 2012 AquaLink *********/

#include "main.h"

typedef enum
{
    STEP_MOTOR_4 = 0,
    STEP_MOTOR_6
}NB_POLE_MOTOR;

typedef enum
{
    MOTOR_STOP,
    STEP_1,
    STEP_2,
    STEP_3,
    STEP_4
}MOTOR_4_POLE_STEP;

typedef struct
{
    uint8_t          id;                /* Stepper ID                           */
    uint32_t         Stepper_x_speed;   /* Stepper speed                        */
    NB_POLE_MOTOR    Nb_pole_motor;     /* Stepper nb pole                      */
    uint8_t          Out_1;             /* output control 1                      */
    uint8_t          Out_2;             /* output control 2                      */
    uint8_t          Out_3;             /* output control 3                      */
    uint8_t          Out_4;             /* output control 4                      */
}Stepper_def_t;

/**
  * @brief  Main function of Stepper.
  * @param  none
  * @retval None
  */
void vTaskCTRL_Stepper();

/**
  * @brief  Manage Stepper 1.
  * @param  none
  * @retval None
  */
void vTask_Stepper_1();

/**
  * @brief  Manage Stepper 2.
  * @param  none
  * @retval None
  */
void vTask_Stepper_2();

/**
  * @brief  Set Stepper mode
  * @param  none
  * @retval None
  */
void Stepper_SetMode(uint8_t id, bool mode);

/**
  * @brief  Set Stepper speed
  * @param  none
  * @retval None
  */
void Stepper_SetSpeed(uint8_t id, uint32_t speed);

/**
  * @brief  Set Stepper min
  * @param  none
  * @retval None
  */
void Stepper_SetMin(uint8_t id, uint8_t min);

/**
  * @brief  Set Stepper max
  * @param  none
  * @retval None
  */
void Stepper_SetMax(uint8_t id, uint8_t max);

/**
  * @brief  Set Stepper pause
  * @param  none
  * @retval None
  */
void Stepper_SetPause(uint8_t id, uint32_t pause);

/**
 * @brief  Get Stepper mode
 * @param  none
 * @retval None
 */
bool Stepper_GetMode(uint8_t id);

/**
 * @brief  Get Stepper speed
 * @param  none
 * @retval None
 */
uint32_t Stepper_GetSpeed(uint8_t id);

/**
 * @brief  Get Stepper min
 * @param  none
 * @retval None
 */
uint8_t Stepper_GetMin(uint8_t id);

/**
 * @brief  Get Stepper max
 * @param  none
 * @retval None
 */
uint8_t Stepper_GetMax(uint8_t id);

/**
 * @brief  Get Stepper pause, juste for ramdom mode, time between two random position
 * @param  none
 * @retval None
 */
uint32_t Stepper_GetPause(uint8_t id);
